<template>
  <div class="list-wrapper">
    <table class="list-table" border="0" cellspacing="0" cellpadding="0">
      <thead>
      <tr>
        <th width="160">身份证号码/SIB</th>
        <th>姓名</th>
        <th>邮箱</th>
        <th>电话</th>
        <th>职位</th>
        <th>同职务海龄</th>
        <th>船型</th>
        <th>船东</th>
        <th>代理公司</th>
      </tr>
      </thead>
      <tbody>
      <tr v-for="item in list" :key="item.id" @click="detail(item.id)">
        <td>{{item.idcard||item.sib}}</td>
        <td>{{item.name || item.ename}}</td>
        <td>{{item.email}}</td>
        <td>{{item.tel}}</td>
        <td>{{item.zhiwu}}</td>
        <td>{{item.agework}}</td>
        <td>{{item.crewtype}}</td>
        <td>{{item.chuandong}}</td>
        <td>{{item.daili}}</td>
      </tr>
      </tbody>
    </table>
    <div class="namtc-pagination">
      <el-pagination @current-change="handleCurrentChange" :current-page="page" :page-size="10"
                     layout="total, prev, pager, next, jumper" :total="total">
      </el-pagination>
    </div>
  </div>
</template>
<script>
  
  export default {
    data() {
      return {
        page: 1,
        total: 0,
        list: [],
        student: '',
      }
    },
    
    methods: {
      fetchData(){
        let data = {
        	page: this.page,
        	keyword: this.student
        }
        
        this.apiPost('System/searchTrainee', data).then(res=>{
          this.list = res.list
          this.total = parseInt(res.total)
        })
      },

      handleCurrentChange(val){
        this.page = val
        this.fetchData()
      },

      detail(id){
        router.push('/trainee/detail/'+id)
      }
    },
    created(){
      this.student = Lockr.get('StudentSearch')
      this.fetchData()
    },

  }
</script>
<style scoped>

</style>
